<template>
	<div class="content">
		<template v-for="item in list">
			<uni-section :title="item.year" type="line">
				<template v-for=" it in item.list">
					<uni-group mode="card"  style="line-height: 40rpx;">
						<view> {{it.date}} </view>
						<view> 消费项目：{{it.project}} </view>
						<view> 对话次数：{{it.tell}} <span v-if="it.num>1">*{{it.num}}</span> </view>
						<view> 消费金额：{{it.money}} </view>
					</uni-group>	
				</template>		
					
			</uni-section>
		</template>
			<Empty v-if="list.length == 0"></Empty>	
	</div>
</template>

<script setup>
	import { onLoad } from '@dcloudio/uni-app';
import { ref } from 'vue'
import {uniStorage} from "../../utils"
import Empty from "../../components/Empty.vue"
import { quaryorderList } from "../../api/index.js"
let userInfo=ref()
	onLoad(()=>{
		userInfo.value = uniStorage.getValue("userInfo")
		getQuaryorderList(userInfo.value.userId)
	})
	
	async function getQuaryorderList(userId){
		try{
			let res = await quaryorderList({userId:userId})
			if(res.code == 200){
				list.value = res.data || []
			}
		}catch(err){
			
		}
		
		
	}
	let list = ref([
		{
			year:2025,
			list:[{
				date:"2025/4/1",
				project:'套餐一',
				money:200,
				tell:10000,
				num:1,
			},
			{
				date:"2025/7/1",
				project:'套餐二',
				money:2000,
				tell:10000,
				num:2
			}]
		},
		{
			year:2024,
			list:[{
				date:"2024/4/1",
				project:'套餐一',
				money:200,
				tell:10000,
				num:1
			},
			{
				date:"2024/7/1",
				project:'套餐二',
				money:2000,
				tell:10000,
				num:2
			}]
		}
	])
</script>


<style lang="scss">
	.uni-section-content{
		padding-bottom: 20rpx;
		margin-bottom: 20rpx;
	}
	.content{
		margin-top:20rpx;
		
	}
</style>